//-----------------------------------------------------------------------------
// Bend2D - Physics Engine
// Roberto Bender <beto.bender@gmail.com>
// Description: 
// Date: 26/03/2010
//-----------------------------------------------------------------------------
#ifndef LOG_H
#define LOG_H

#include "benchmarking.h"

#include <fstream>
#include <sstream>
using namespace std;

namespace bend2d
{

#ifdef BEND2DLOG
    class Log
    {
    public:
        enum logLevel { eLogNone, eLogError, eLogWarning, eLogDebug, eLogInfo };
        void SetLogLevel(logLevel level);
        void Write(logLevel level, const stringstream& stream);
        static Log* GetInstance();
    private:
        Log();
        static Log* m_Intance;
        logLevel m_LogLevel;
        ofstream * m_File;
        StopWatch m_Timer;
    };
#endif

#define log_info(x)  { stringstream str; str << "[ INFO][" << __LINE__ << "][" << __FUNCTION__ << "]:" << x; Log::GetInstance()->Write(Log::eLogInfo, str); }
#define log_debug(x) { stringstream str; str << "[DEBUG][" << __LINE__ << "][" << __FUNCTION__ << "]:" << x; Log::GetInstance()->Write(Log::eLogDebug, str); }

}

#endif
